package cn.tedu.online.day01wan;

import java.util.Objects;

public class Student implements Comparable<Student>{
    private Integer age;
    private Integer height;
    private Integer weight;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return age.equals(student.age);
    }

    @Override
    public int hashCode() {
        return Objects.hash(age);
    }

    @Override
    public String toString() {
        return "Student{" +
                "age=" + age +
                ", height='" + height + '\'' +
                ", weight='" + weight + '\'' +
                '}';
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Integer getHeight() {
        return height;
    }

    public void setHeight(Integer height) {
        this.height = height;
    }

    public Integer getWeight() {
        return weight;
    }

    public void setWeight(Integer weight) {
        this.weight = weight;
    }

    public Student(Integer age, Integer height, Integer weight) {
        this.age = age;
        this.height = height;
        this.weight = weight;
    }

    @Override
    public int compareTo(Student o) {
        return o.getAge()-this.age;
    }
}
